 <link type="text/css" href="/admins/js/pagerView/pager-view.css" rel="stylesheet" />
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/jquery/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="/admins/js/jquery/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/admins/js/pagerView/pager-view.js"></script>
<script type="text/javascript">
    $(function(){
    
        $.datepicker.setDefaults( $.datepicker.regional[ "zh-CN" ] );
        $( "#form1 #sel #starttime" ).datepicker({
            changeMonth: true,
            changeYear: true
        });
        $( "#form1 #sel #endtime" ).datepicker({
            changeMonth: true,
            changeYear: true
        });
    });
</script>
<style>
	.datatable {
                width:90%;
		text-align: left;
		font-size: 12px;
		font-family: verdana;
		background: #c0c0c0; margin:2px;
	}

	.datatable thead tr,

	.datatable tfoot tr {
		background: #c0c0c0;
	}

	.datatable tbody tr {
		background: #f0f0f0;
                height: 30px;
	}
        
        .dataTable span{
            margin-left: 20px;
            font-size: 14px;
            vertical-align: middle;
        }
	.datatable td, th {
		border: 1px solid white; height:28px;
	}
	.datatable td {background-color:white;}
	
	.datatable .hover td {background-color:#99CCFF;}
	
	.datatable .select td {background-color:#EEEE99;}

	#ui-datepicker-div{ font-size:12px;}
</style>
<div style="padding:2px; margin:2px;" class="dataTable">
    <form action="/managebuyshop/index/"  method="get" style="margin:0px" id="form1">
        <div style=" border:1px solid #DDDDDD; padding:2px; margin:2px;line-height: 36px;" id='sel'> 
            <label for="name">用户名：</label><input type="text" id="username" name="username" value="<?php echo $this->username;?>"/>
            <label for="orderno">订单号：</label><input type="text" id="orderno" name="orderno" value="<?php echo $this->orderno;?>"/>
            <label for="starttime">提交时间：</label><input type="text" id="starttime" name="starttime" value="<?php echo $this->starttime;?>" />
            <label for="endtime">-- </label><input type="text" id="endtime" name="endtime" value="<?php echo $this->endtime;?>"  />
            <label for="status">状态：</label>
            <select id="status" name="status">
                  <?php foreach ($this->arrsta as $key => $val){?>
                    <option value="<?php echo $key;?>" <?php if($this->status==$key){echo "selected";}?>><?php echo $val;?></option>
                  <?php }?>
                    <option value="" <?php if($this->status==""){echo "selected";}?>>所有</option>
            </select>
            <input type="submit" id="queryButton" name="queryButton" value="查询"/>
        </div>
    </form>
<table cellspacing="1" width="100%" class="datatable" id="waybill-table">
	<thead>
		<tr >
                    <th class="w0" width="10%">订单号/用户</th>
                    <th class="w1" width="10%">状态</th>
                    <th class="w0" width="10%">实付款</th>
                    <th class="w1" width="8%">单价</th>
                    <th class="w0" width="8%">数量</th>
                    <th class="w1" width="36%">名称</th>
                    <th class="w0">属性</th>
		</tr>
	</thead>
	<tbody>
                <?php
                    if( $this->buydetail != ''){
                        $i = 1;
                    foreach ($this->buydetail as $Item) {
                        $shopdetail = $Item->shipdetail;
                        //var_dump($shopdetail);exit;
                        ?>
                    <tr>
                        <td class="w0" rowspan="<?php echo count($shopdetail);?>" align="center"><a href='/managebuyshop/buyshop/id/<?php echo $Item->id;?>'><?php echo $Item->id;?><br>
                            <?php echo $Item->byuserdetail->nikename;?></a></td>
                        <td class="w1" rowspan="<?php echo count($shopdetail);?>" align="center"><?php echo $Item->StatusText;?></td>
                        <td class="w0" rowspan="<?php echo count($shopdetail);?>" align="center">￥<?php echo $Item->sum;echo $this->Item->type==1?"<br>(含运费)":"";?></td>
                            <?php  if($shopdetail != null){ 
                                foreach ($shopdetail as $key => $val) { 
                                    if(count($shopdetail)>1){ 
                                        if($key > 0){
                                            echo "</tr><tr>";
                                        }
                                    }
                                    $productd = $val->byproductd;
                                    ?>
                                    <td class="w1" align="center" ><?php echo $val->price;?></td>
                                    <td class="w0" align="center" ><?php echo $val->quantity;?></td>
                                    <td valign="middle" class="w1" >
                                        <a href="<?php echo $productd->remoteImage;?>" target="_blank"><img src="<?php echo $productd->remoteImage;?>" width="50px" height="50px" style="vertical-align:middle;"/></a>
                                        <a href="<?php echo $productd->url;?>" target="_blank"><?php echo strlen($val->productName)>50?mb_substr($val->productName,0,50, 'utf-8'):$val->productName;?></a>
                                    </td>
                                    <td class="w1"> <?php  echo $productd->PropertyAlias;?></td>
                            <?php }
                            }else{
                            ?>
                                    <td class="w1" align="center"></td>
                                    <td class="w0" align="center"></td>
                                    <td valign="middle" class="w1"></td>
                                    <td class="w1"></td>
                    </tr>
                <?php } }
                    $i++;
                }?>
	</tbody>
</table>
 <?php
    echo $this->partial('paging.phtml', array("pages" => $this->result,"pamas"=>"username=".$this->username."&storeno=$this->storeno&dateselect=$this->dateselect&starttime=$this->starttime&endtime=$this->endtime&status=$this->status"));        
?>
</div>
